package notas.daem;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class NotasAsigDAEMActivity extends Activity {
	
	EditText nombreasignatura ;
	Button btnguardaasig;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        nombreasignatura = (EditText)findViewById(R.id.editasignatura);
        btnguardaasig = (Button)findViewById(R.id.btnguardaasig);
        
        btnguardaasig.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				String nameAsignatura = nombreasignatura.getText().toString();
				if(!("").equals(nameAsignatura) && nameAsignatura != null){
					
					Intent i = new Intent();
					i.setClass(getApplicationContext(), NotaApp.class);
					i.putExtra("asignatura", nameAsignatura);
					startActivity(i);
					
				}
				
				else{
					Toast.makeText(getApplicationContext(), "No ha digitado una asignatura", Toast.LENGTH_LONG).show();
				}
			}
		});
    }
}